<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span id="local-6989586621680954159"></span><span class="hs-comment">{-
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998

\section[StgStats]{Gathers statistical information about programs}


The program gather statistics about
\begin{enumerate}
\item number of boxed cases
\item number of unboxed cases
\item number of let-no-escapes
\item number of non-updatable lets
\item number of updatable lets
\item number of applications
\item number of primitive applications
\item number of closures (does not include lets bound to constructors)
\item number of free variables in closures
%\item number of top-level functions
%\item number of top-level CAFs
\item number of constructors
\end{enumerate}
-}</span><span>
</span><span id="line-23"></span><span>
</span><span id="line-24"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-25"></span><span>
</span><span id="line-26"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Stg.Stats</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#showStgStats"><span class="hs-identifier">showStgStats</span></a></span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html"><span class="hs-identifier">GHC.Stg.Syntax</span></a></span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier">Id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html"><span class="hs-identifier">GHC.Utils.Panic</span></a></span><span>
</span><span id="line-36"></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../containers/src/Data.Map.html#"><span class="hs-identifier">Data.Map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../containers/src/Data.Map.Internal.html#Map"><span class="hs-identifier">Map</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../containers/src/Data.Map.html#"><span class="hs-identifier">Data.Map</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Map</span></span><span>
</span><span id="line-39"></span><span>
</span><span id="line-40"></span><span class="hs-keyword">data</span><span> </span><span id="CounterType"><span class="annot"><a href="GHC.Stg.Stats.html#CounterType"><span class="hs-identifier hs-var">CounterType</span></a></span></span><span>
</span><span id="line-41"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="Literals"><span class="annot"><a href="GHC.Stg.Stats.html#Literals"><span class="hs-identifier hs-var">Literals</span></a></span></span><span>
</span><span id="line-42"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Applications"><span class="annot"><a href="GHC.Stg.Stats.html#Applications"><span class="hs-identifier hs-var">Applications</span></a></span></span><span>
</span><span id="line-43"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ConstructorApps"><span class="annot"><a href="GHC.Stg.Stats.html#ConstructorApps"><span class="hs-identifier hs-var">ConstructorApps</span></a></span></span><span>
</span><span id="line-44"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="PrimitiveApps"><span class="annot"><a href="GHC.Stg.Stats.html#PrimitiveApps"><span class="hs-identifier hs-var">PrimitiveApps</span></a></span></span><span>
</span><span id="line-45"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="LetNoEscapes"><span class="annot"><a href="GHC.Stg.Stats.html#LetNoEscapes"><span class="hs-identifier hs-var">LetNoEscapes</span></a></span></span><span>
</span><span id="line-46"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="StgCases"><span class="annot"><a href="GHC.Stg.Stats.html#StgCases"><span class="hs-identifier hs-var">StgCases</span></a></span></span><span>
</span><span id="line-47"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="FreeVariables"><span class="annot"><a href="GHC.Stg.Stats.html#FreeVariables"><span class="hs-identifier hs-var">FreeVariables</span></a></span></span><span>
</span><span id="line-48"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ConstructorBinds"><span class="annot"><a href="GHC.Stg.Stats.html#ConstructorBinds"><span class="hs-identifier hs-var">ConstructorBinds</span></a></span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-comment">{-True&lt;=&gt;top-level-}</span><span>
</span><span id="line-49"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ReEntrantBinds"><span class="annot"><a href="GHC.Stg.Stats.html#ReEntrantBinds"><span class="hs-identifier hs-var">ReEntrantBinds</span></a></span></span><span>   </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-comment">{-ditto-}</span><span>
</span><span id="line-50"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="SingleEntryBinds"><span class="annot"><a href="GHC.Stg.Stats.html#SingleEntryBinds"><span class="hs-identifier hs-var">SingleEntryBinds</span></a></span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-comment">{-ditto-}</span><span>
</span><span id="line-51"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="UpdatableBinds"><span class="annot"><a href="GHC.Stg.Stats.html#UpdatableBinds"><span class="hs-identifier hs-var">UpdatableBinds</span></a></span></span><span>   </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-comment">{-ditto-}</span><span>
</span><span id="line-52"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680954129"><span id="local-6989586621680954136"><span class="annot"><span class="annottext">CounterType -&gt; CounterType -&gt; Bool
(CounterType -&gt; CounterType -&gt; Bool)
-&gt; (CounterType -&gt; CounterType -&gt; Bool) -&gt; Eq CounterType
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: CounterType -&gt; CounterType -&gt; Bool
$c/= :: CounterType -&gt; CounterType -&gt; Bool
== :: CounterType -&gt; CounterType -&gt; Bool
$c== :: CounterType -&gt; CounterType -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680954107"><span id="local-6989586621680954109"><span id="local-6989586621680954111"><span id="local-6989586621680954113"><span id="local-6989586621680954115"><span id="local-6989586621680954117"><span id="local-6989586621680954124"><span class="annot"><span class="annottext">Eq CounterType
Eq CounterType
-&gt; (CounterType -&gt; CounterType -&gt; Ordering)
-&gt; (CounterType -&gt; CounterType -&gt; Bool)
-&gt; (CounterType -&gt; CounterType -&gt; Bool)
-&gt; (CounterType -&gt; CounterType -&gt; Bool)
-&gt; (CounterType -&gt; CounterType -&gt; Bool)
-&gt; (CounterType -&gt; CounterType -&gt; CounterType)
-&gt; (CounterType -&gt; CounterType -&gt; CounterType)
-&gt; Ord CounterType
CounterType -&gt; CounterType -&gt; Bool
CounterType -&gt; CounterType -&gt; Ordering
CounterType -&gt; CounterType -&gt; CounterType
forall a.
Eq a
-&gt; (a -&gt; a -&gt; Ordering)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; a)
-&gt; (a -&gt; a -&gt; a)
-&gt; Ord a
min :: CounterType -&gt; CounterType -&gt; CounterType
$cmin :: CounterType -&gt; CounterType -&gt; CounterType
max :: CounterType -&gt; CounterType -&gt; CounterType
$cmax :: CounterType -&gt; CounterType -&gt; CounterType
&gt;= :: CounterType -&gt; CounterType -&gt; Bool
$c&gt;= :: CounterType -&gt; CounterType -&gt; Bool
&gt; :: CounterType -&gt; CounterType -&gt; Bool
$c&gt; :: CounterType -&gt; CounterType -&gt; Bool
&lt;= :: CounterType -&gt; CounterType -&gt; Bool
$c&lt;= :: CounterType -&gt; CounterType -&gt; Bool
&lt; :: CounterType -&gt; CounterType -&gt; Bool
$c&lt; :: CounterType -&gt; CounterType -&gt; Bool
compare :: CounterType -&gt; CounterType -&gt; Ordering
$ccompare :: CounterType -&gt; CounterType -&gt; Ordering
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Ord</span></span></span></span></span></span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span class="hs-keyword">type</span><span> </span><span id="Count"><span class="annot"><a href="GHC.Stg.Stats.html#Count"><span class="hs-identifier hs-var">Count</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-55"></span><span class="hs-keyword">type</span><span> </span><span id="StatEnv"><span class="annot"><a href="GHC.Stg.Stats.html#StatEnv"><span class="hs-identifier hs-var">StatEnv</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="../../containers/src/Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#CounterType"><span class="hs-identifier hs-type">CounterType</span></a></span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#Count"><span class="hs-identifier hs-type">Count</span></a></span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span class="annot"><a href="GHC.Stg.Stats.html#emptySE"><span class="hs-identifier hs-type">emptySE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#StatEnv"><span class="hs-identifier hs-type">StatEnv</span></a></span><span>
</span><span id="line-58"></span><span id="emptySE"><span class="annot"><span class="annottext">emptySE :: StatEnv
</span><a href="GHC.Stg.Stats.html#emptySE"><span class="hs-identifier hs-var hs-var">emptySE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StatEnv
forall k a. Map k a
</span><a href="../../containers/src/Data.Map.Internal.html#empty"><span class="hs-identifier hs-var">Map.empty</span></a></span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span class="annot"><a href="GHC.Stg.Stats.html#combineSE"><span class="hs-identifier hs-type">combineSE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#StatEnv"><span class="hs-identifier hs-type">StatEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#StatEnv"><span class="hs-identifier hs-type">StatEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#StatEnv"><span class="hs-identifier hs-type">StatEnv</span></a></span><span>
</span><span id="line-61"></span><span id="combineSE"><span class="annot"><span class="annottext">combineSE :: StatEnv -&gt; StatEnv -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#combineSE"><span class="hs-identifier hs-var hs-var">combineSE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Count -&gt; Count -&gt; Count) -&gt; StatEnv -&gt; StatEnv -&gt; StatEnv
forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="../../containers/src/Data.Map.Internal.html#unionWith"><span class="hs-identifier hs-var">Map.unionWith</span></a></span><span> </span><span class="annot"><span class="annottext">Count -&gt; Count -&gt; Count
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">(+)</span></a></span><span>
</span><span id="line-62"></span><span>
</span><span id="line-63"></span><span class="annot"><a href="GHC.Stg.Stats.html#combineSEs"><span class="hs-identifier hs-type">combineSEs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Stg.Stats.html#StatEnv"><span class="hs-identifier hs-type">StatEnv</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#StatEnv"><span class="hs-identifier hs-type">StatEnv</span></a></span><span>
</span><span id="line-64"></span><span id="combineSEs"><span class="annot"><span class="annottext">combineSEs :: [StatEnv] -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#combineSEs"><span class="hs-identifier hs-var hs-var">combineSEs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(StatEnv -&gt; StatEnv -&gt; StatEnv) -&gt; StatEnv -&gt; [StatEnv] -&gt; StatEnv
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">StatEnv -&gt; StatEnv -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#combineSE"><span class="hs-identifier hs-var">combineSE</span></a></span><span> </span><span class="annot"><span class="annottext">StatEnv
</span><a href="GHC.Stg.Stats.html#emptySE"><span class="hs-identifier hs-var">emptySE</span></a></span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span class="annot"><a href="GHC.Stg.Stats.html#countOne"><span class="hs-identifier hs-type">countOne</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#CounterType"><span class="hs-identifier hs-type">CounterType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#StatEnv"><span class="hs-identifier hs-type">StatEnv</span></a></span><span>
</span><span id="line-67"></span><span id="countOne"><span class="annot"><span class="annottext">countOne :: CounterType -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#countOne"><span class="hs-identifier hs-var hs-var">countOne</span></a></span></span><span> </span><span id="local-6989586621680954097"><span class="annot"><span class="annottext">CounterType
</span><a href="#local-6989586621680954097"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CounterType -&gt; Count -&gt; StatEnv
forall k a. k -&gt; a -&gt; Map k a
</span><a href="../../containers/src/Data.Map.Internal.html#singleton"><span class="hs-identifier hs-var">Map.singleton</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="#local-6989586621680954097"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-number">1</span></span><span>
</span><span id="line-68"></span><span>
</span><span id="line-69"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{Top-level list of bindings (a ``program'')}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-76"></span><span>
</span><span id="line-77"></span><span class="annot"><a href="GHC.Stg.Stats.html#showStgStats"><span class="hs-identifier hs-type">showStgStats</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgTopBinding"><span class="hs-identifier hs-type">StgTopBinding</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-78"></span><span>
</span><span id="line-79"></span><span id="showStgStats"><span class="annot"><span class="annottext">showStgStats :: [StgTopBinding] -&gt; String
</span><a href="GHC.Stg.Stats.html#showStgStats"><span class="hs-identifier hs-var hs-var">showStgStats</span></a></span></span><span> </span><span id="local-6989586621680954095"><span class="annot"><span class="annottext">[StgTopBinding]
</span><a href="#local-6989586621680954095"><span class="hs-identifier hs-var">prog</span></a></span></span><span>
</span><span id="line-80"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;STG Statistics:\n\n&quot;</span></span><span>
</span><span id="line-81"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">((CounterType, Count) -&gt; String)
-&gt; [(CounterType, Count)] -&gt; String
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">(CounterType, Count) -&gt; String
forall {a}. Show a =&gt; (CounterType, a) -&gt; String
</span><a href="#local-6989586621680954093"><span class="hs-identifier hs-var">showc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StatEnv -&gt; [(CounterType, Count)]
forall k a. Map k a -&gt; [(k, a)]
</span><a href="../../containers/src/Data.Map.Internal.html#toList"><span class="hs-identifier hs-var">Map.toList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[StgTopBinding] -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#gatherStgStats"><span class="hs-identifier hs-var">gatherStgStats</span></a></span><span> </span><span class="annot"><span class="annottext">[StgTopBinding]
</span><a href="#local-6989586621680954095"><span class="hs-identifier hs-var">prog</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-82"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-83"></span><span>    </span><span id="local-6989586621680954093"><span class="annot"><span class="annottext">showc :: (CounterType, a) -&gt; String
</span><a href="#local-6989586621680954093"><span class="hs-identifier hs-var hs-var">showc</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680954088"><span class="annot"><span class="annottext">CounterType
</span><a href="#local-6989586621680954088"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680954087"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680954087"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
</span><a href="../../base/src/GHC.Show.html#showString"><span class="hs-identifier hs-var">showString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CounterType -&gt; String
</span><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="#local-6989586621680954088"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; (String -&gt; String) -&gt; String -&gt; String
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; String -&gt; String
forall a. Show a =&gt; a -&gt; String -&gt; String
</span><a href="../../base/src/GHC.Show.html#shows"><span class="hs-identifier hs-var">shows</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680954087"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\n&quot;</span></span><span>
</span><span id="line-84"></span><span>
</span><span id="line-85"></span><span>    </span><span id="local-6989586621680954085"><span class="annot"><span class="annottext">s :: CounterType -&gt; String
</span><a href="#local-6989586621680954085"><span class="hs-identifier hs-var hs-var">s</span></a></span></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="GHC.Stg.Stats.html#Literals"><span class="hs-identifier hs-var">Literals</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Literals                   &quot;</span></span><span>
</span><span id="line-86"></span><span>    </span><span class="annot"><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="GHC.Stg.Stats.html#Applications"><span class="hs-identifier hs-var">Applications</span></a></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Applications               &quot;</span></span><span>
</span><span id="line-87"></span><span>    </span><span class="annot"><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="GHC.Stg.Stats.html#ConstructorApps"><span class="hs-identifier hs-var">ConstructorApps</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ConstructorApps            &quot;</span></span><span>
</span><span id="line-88"></span><span>    </span><span class="annot"><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="GHC.Stg.Stats.html#PrimitiveApps"><span class="hs-identifier hs-var">PrimitiveApps</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;PrimitiveApps              &quot;</span></span><span>
</span><span id="line-89"></span><span>    </span><span class="annot"><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="GHC.Stg.Stats.html#LetNoEscapes"><span class="hs-identifier hs-var">LetNoEscapes</span></a></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;LetNoEscapes               &quot;</span></span><span>
</span><span id="line-90"></span><span>    </span><span class="annot"><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="GHC.Stg.Stats.html#StgCases"><span class="hs-identifier hs-var">StgCases</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;StgCases                   &quot;</span></span><span>
</span><span id="line-91"></span><span>    </span><span class="annot"><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="GHC.Stg.Stats.html#FreeVariables"><span class="hs-identifier hs-var">FreeVariables</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;FreeVariables              &quot;</span></span><span>
</span><span id="line-92"></span><span>    </span><span class="annot"><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Stats.html#ConstructorBinds"><span class="hs-identifier hs-type">ConstructorBinds</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ConstructorBinds_Top       &quot;</span></span><span>
</span><span id="line-93"></span><span>    </span><span class="annot"><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Stats.html#ReEntrantBinds"><span class="hs-identifier hs-type">ReEntrantBinds</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ReEntrantBinds_Top         &quot;</span></span><span>
</span><span id="line-94"></span><span>    </span><span class="annot"><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Stats.html#SingleEntryBinds"><span class="hs-identifier hs-type">SingleEntryBinds</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;SingleEntryBinds_Top       &quot;</span></span><span>
</span><span id="line-95"></span><span>    </span><span class="annot"><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Stats.html#UpdatableBinds"><span class="hs-identifier hs-type">UpdatableBinds</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;UpdatableBinds_Top         &quot;</span></span><span>
</span><span id="line-96"></span><span>    </span><span class="annot"><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Stats.html#ConstructorBinds"><span class="hs-identifier hs-type">ConstructorBinds</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ConstructorBinds_Nested    &quot;</span></span><span>
</span><span id="line-97"></span><span>    </span><span class="annot"><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Stats.html#ReEntrantBinds"><span class="hs-identifier hs-type">ReEntrantBinds</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ReEntrantBindsBinds_Nested &quot;</span></span><span>
</span><span id="line-98"></span><span>    </span><span class="annot"><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Stats.html#SingleEntryBinds"><span class="hs-identifier hs-type">SingleEntryBinds</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;SingleEntryBinds_Nested    &quot;</span></span><span>
</span><span id="line-99"></span><span>    </span><span class="annot"><a href="#local-6989586621680954085"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Stats.html#UpdatableBinds"><span class="hs-identifier hs-type">UpdatableBinds</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;UpdatableBinds_Nested      &quot;</span></span><span>
</span><span id="line-100"></span><span>
</span><span id="line-101"></span><span class="annot"><a href="GHC.Stg.Stats.html#gatherStgStats"><span class="hs-identifier hs-type">gatherStgStats</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgTopBinding"><span class="hs-identifier hs-type">StgTopBinding</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#StatEnv"><span class="hs-identifier hs-type">StatEnv</span></a></span><span>
</span><span id="line-102"></span><span id="gatherStgStats"><span class="annot"><span class="annottext">gatherStgStats :: [StgTopBinding] -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#gatherStgStats"><span class="hs-identifier hs-var hs-var">gatherStgStats</span></a></span></span><span> </span><span id="local-6989586621680954082"><span class="annot"><span class="annottext">[StgTopBinding]
</span><a href="#local-6989586621680954082"><span class="hs-identifier hs-var">binds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[StatEnv] -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#combineSEs"><span class="hs-identifier hs-var">combineSEs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(StgTopBinding -&gt; StatEnv) -&gt; [StgTopBinding] -&gt; [StatEnv]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">StgTopBinding -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statTopBinding"><span class="hs-identifier hs-var">statTopBinding</span></a></span><span> </span><span class="annot"><span class="annottext">[StgTopBinding]
</span><a href="#local-6989586621680954082"><span class="hs-identifier hs-var">binds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-103"></span><span>
</span><span id="line-104"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{Bindings}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-111"></span><span>
</span><span id="line-112"></span><span class="annot"><a href="GHC.Stg.Stats.html#statTopBinding"><span class="hs-identifier hs-type">statTopBinding</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgTopBinding"><span class="hs-identifier hs-type">StgTopBinding</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#StatEnv"><span class="hs-identifier hs-type">StatEnv</span></a></span><span>
</span><span id="line-113"></span><span id="statTopBinding"><span class="annot"><span class="annottext">statTopBinding :: StgTopBinding -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statTopBinding"><span class="hs-identifier hs-var hs-var">statTopBinding</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgTopStringLit"><span class="hs-identifier hs-type">StgTopStringLit</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CounterType -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#countOne"><span class="hs-identifier hs-var">countOne</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="GHC.Stg.Stats.html#Literals"><span class="hs-identifier hs-var">Literals</span></a></span><span>
</span><span id="line-114"></span><span class="annot"><a href="GHC.Stg.Stats.html#statTopBinding"><span class="hs-identifier hs-var">statTopBinding</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgTopLifted"><span class="hs-identifier hs-type">StgTopLifted</span></a></span><span> </span><span id="local-6989586621680954078"><span class="annot"><span class="annottext">GenStgBinding 'Vanilla
</span><a href="#local-6989586621680954078"><span class="hs-identifier hs-var">bind</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; GenStgBinding 'Vanilla -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statBinding"><span class="hs-identifier hs-var">statBinding</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">GenStgBinding 'Vanilla
</span><a href="#local-6989586621680954078"><span class="hs-identifier hs-var">bind</span></a></span><span>
</span><span id="line-115"></span><span>
</span><span id="line-116"></span><span class="annot"><a href="GHC.Stg.Stats.html#statBinding"><span class="hs-identifier hs-type">statBinding</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-comment">-- True &lt;=&gt; top-level; False &lt;=&gt; nested</span><span>
</span><span id="line-117"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgBinding"><span class="hs-identifier hs-type">StgBinding</span></a></span><span>
</span><span id="line-118"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#StatEnv"><span class="hs-identifier hs-type">StatEnv</span></a></span><span>
</span><span id="line-119"></span><span>
</span><span id="line-120"></span><span id="statBinding"><span class="annot"><span class="annottext">statBinding :: Bool -&gt; GenStgBinding 'Vanilla -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statBinding"><span class="hs-identifier hs-var hs-var">statBinding</span></a></span></span><span> </span><span id="local-6989586621680954075"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680954075"><span class="hs-identifier hs-var">top</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgNonRec"><span class="hs-identifier hs-type">StgNonRec</span></a></span><span> </span><span id="local-6989586621680954073"><span class="annot"><span class="annottext">BinderP 'Vanilla
</span><a href="#local-6989586621680954073"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621680954072"><span class="annot"><span class="annottext">GenStgRhs 'Vanilla
</span><a href="#local-6989586621680954072"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-121"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; (Id, GenStgRhs 'Vanilla) -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statRhs"><span class="hs-identifier hs-var">statRhs</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680954075"><span class="hs-identifier hs-var">top</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
BinderP 'Vanilla
</span><a href="#local-6989586621680954073"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">GenStgRhs 'Vanilla
</span><a href="#local-6989586621680954072"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-122"></span><span>
</span><span id="line-123"></span><span class="annot"><a href="GHC.Stg.Stats.html#statBinding"><span class="hs-identifier hs-var">statBinding</span></a></span><span> </span><span id="local-6989586621680954070"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680954070"><span class="hs-identifier hs-var">top</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRec"><span class="hs-identifier hs-type">StgRec</span></a></span><span> </span><span id="local-6989586621680954068"><span class="annot"><span class="annottext">[(BinderP 'Vanilla, GenStgRhs 'Vanilla)]
</span><a href="#local-6989586621680954068"><span class="hs-identifier hs-var">pairs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-124"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[StatEnv] -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#combineSEs"><span class="hs-identifier hs-var">combineSEs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((Id, GenStgRhs 'Vanilla) -&gt; StatEnv)
-&gt; [(Id, GenStgRhs 'Vanilla)] -&gt; [StatEnv]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; (Id, GenStgRhs 'Vanilla) -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statRhs"><span class="hs-identifier hs-var">statRhs</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680954070"><span class="hs-identifier hs-var">top</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Id, GenStgRhs 'Vanilla)]
[(BinderP 'Vanilla, GenStgRhs 'Vanilla)]
</span><a href="#local-6989586621680954068"><span class="hs-identifier hs-var">pairs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-125"></span><span>
</span><span id="line-126"></span><span class="annot"><a href="GHC.Stg.Stats.html#statRhs"><span class="hs-identifier hs-type">statRhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhs"><span class="hs-identifier hs-type">StgRhs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#StatEnv"><span class="hs-identifier hs-type">StatEnv</span></a></span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span id="statRhs"><span class="annot"><span class="annottext">statRhs :: Bool -&gt; (Id, GenStgRhs 'Vanilla) -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statRhs"><span class="hs-identifier hs-var hs-var">statRhs</span></a></span></span><span> </span><span id="local-6989586621680954066"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680954066"><span class="hs-identifier hs-var">top</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhsCon"><span class="hs-identifier hs-type">StgRhsCon</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-129"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CounterType -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#countOne"><span class="hs-identifier hs-var">countOne</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; CounterType
</span><a href="GHC.Stg.Stats.html#ConstructorBinds"><span class="hs-identifier hs-var">ConstructorBinds</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680954066"><span class="hs-identifier hs-var">top</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-130"></span><span>
</span><span id="line-131"></span><span class="annot"><a href="GHC.Stg.Stats.html#statRhs"><span class="hs-identifier hs-var">statRhs</span></a></span><span> </span><span id="local-6989586621680954064"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680954064"><span class="hs-identifier hs-var">top</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgRhsClosure"><span class="hs-identifier hs-type">StgRhsClosure</span></a></span><span> </span><span class="annot"><span class="annottext">XRhsClosure 'Vanilla
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">CostCentreStack
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680954062"><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621680954062"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="annot"><span class="annottext">[BinderP 'Vanilla]
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680954061"><span class="annot"><span class="annottext">GenStgExpr 'Vanilla
</span><a href="#local-6989586621680954061"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-132"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenStgExpr 'Vanilla -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var">statExpr</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgExpr 'Vanilla
</span><a href="#local-6989586621680954061"><span class="hs-identifier hs-var">body</span></a></span><span> </span><span class="annot"><span class="annottext">StatEnv -&gt; StatEnv -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#combineSE"><span class="hs-operator hs-var">`combineSE`</span></a></span><span>
</span><span id="line-133"></span><span>    </span><span class="annot"><span class="annottext">CounterType -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#countOne"><span class="hs-identifier hs-var">countOne</span></a></span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-134"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="#local-6989586621680954062"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-135"></span><span>        </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="GHC.Stg.Syntax.html#ReEntrant"><span class="hs-identifier hs-var">ReEntrant</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; CounterType
</span><a href="GHC.Stg.Stats.html#ReEntrantBinds"><span class="hs-identifier hs-var">ReEntrantBinds</span></a></span><span>   </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680954064"><span class="hs-identifier hs-var">top</span></a></span><span>
</span><span id="line-136"></span><span>        </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="GHC.Stg.Syntax.html#Updatable"><span class="hs-identifier hs-var">Updatable</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; CounterType
</span><a href="GHC.Stg.Stats.html#UpdatableBinds"><span class="hs-identifier hs-var">UpdatableBinds</span></a></span><span>   </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680954064"><span class="hs-identifier hs-var">top</span></a></span><span>
</span><span id="line-137"></span><span>        </span><span class="annot"><span class="annottext">UpdateFlag
</span><a href="GHC.Stg.Syntax.html#SingleEntry"><span class="hs-identifier hs-var">SingleEntry</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; CounterType
</span><a href="GHC.Stg.Stats.html#SingleEntryBinds"><span class="hs-identifier hs-var">SingleEntryBinds</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680954064"><span class="hs-identifier hs-var">top</span></a></span><span>
</span><span id="line-138"></span><span>    </span><span class="hs-special">)</span><span>
</span><span id="line-139"></span><span>
</span><span id="line-140"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{Expressions}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-147"></span><span>
</span><span id="line-148"></span><span class="annot"><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-type">statExpr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Stg.Syntax.html#StgExpr"><span class="hs-identifier hs-type">StgExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Stg.Stats.html#StatEnv"><span class="hs-identifier hs-type">StatEnv</span></a></span><span>
</span><span id="line-149"></span><span>
</span><span id="line-150"></span><span id="statExpr"><span class="annot"><span class="annottext">statExpr :: GenStgExpr 'Vanilla -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var hs-var">statExpr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgApp"><span class="hs-identifier hs-type">StgApp</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CounterType -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#countOne"><span class="hs-identifier hs-var">countOne</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="GHC.Stg.Stats.html#Applications"><span class="hs-identifier hs-var">Applications</span></a></span><span>
</span><span id="line-151"></span><span class="annot"><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var">statExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgLit"><span class="hs-identifier hs-type">StgLit</span></a></span><span> </span><span class="annot"><span class="annottext">Literal
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CounterType -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#countOne"><span class="hs-identifier hs-var">countOne</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="GHC.Stg.Stats.html#Literals"><span class="hs-identifier hs-var">Literals</span></a></span><span>
</span><span id="line-152"></span><span class="annot"><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var">statExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgConApp"><span class="hs-identifier hs-type">StgConApp</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CounterType -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#countOne"><span class="hs-identifier hs-var">countOne</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="GHC.Stg.Stats.html#ConstructorApps"><span class="hs-identifier hs-var">ConstructorApps</span></a></span><span>
</span><span id="line-153"></span><span class="annot"><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var">statExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgOpApp"><span class="hs-identifier hs-type">StgOpApp</span></a></span><span> </span><span class="annot"><span class="annottext">StgOp
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[StgArg]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CounterType -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#countOne"><span class="hs-identifier hs-var">countOne</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="GHC.Stg.Stats.html#PrimitiveApps"><span class="hs-identifier hs-var">PrimitiveApps</span></a></span><span>
</span><span id="line-154"></span><span class="annot"><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var">statExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgTick"><span class="hs-identifier hs-type">StgTick</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Id
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680954050"><span class="annot"><span class="annottext">GenStgExpr 'Vanilla
</span><a href="#local-6989586621680954050"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenStgExpr 'Vanilla -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var">statExpr</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgExpr 'Vanilla
</span><a href="#local-6989586621680954050"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-155"></span><span>
</span><span id="line-156"></span><span class="annot"><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var">statExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgLetNoEscape"><span class="hs-identifier hs-type">StgLetNoEscape</span></a></span><span> </span><span class="annot"><span class="annottext">XLetNoEscape 'Vanilla
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680954048"><span class="annot"><span class="annottext">GenStgBinding 'Vanilla
</span><a href="#local-6989586621680954048"><span class="hs-identifier hs-var">binds</span></a></span></span><span> </span><span id="local-6989586621680954047"><span class="annot"><span class="annottext">GenStgExpr 'Vanilla
</span><a href="#local-6989586621680954047"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-157"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; GenStgBinding 'Vanilla -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statBinding"><span class="hs-identifier hs-var">statBinding</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-comment">{-not top-level-}</span><span> </span><span class="annot"><span class="annottext">GenStgBinding 'Vanilla
</span><a href="#local-6989586621680954048"><span class="hs-identifier hs-var">binds</span></a></span><span>    </span><span class="annot"><span class="annottext">StatEnv -&gt; StatEnv -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#combineSE"><span class="hs-operator hs-var">`combineSE`</span></a></span><span>
</span><span id="line-158"></span><span>    </span><span class="annot"><span class="annottext">GenStgExpr 'Vanilla -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var">statExpr</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgExpr 'Vanilla
</span><a href="#local-6989586621680954047"><span class="hs-identifier hs-var">body</span></a></span><span>                               </span><span class="annot"><span class="annottext">StatEnv -&gt; StatEnv -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#combineSE"><span class="hs-operator hs-var">`combineSE`</span></a></span><span>
</span><span id="line-159"></span><span>    </span><span class="annot"><span class="annottext">CounterType -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#countOne"><span class="hs-identifier hs-var">countOne</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="GHC.Stg.Stats.html#LetNoEscapes"><span class="hs-identifier hs-var">LetNoEscapes</span></a></span><span>
</span><span id="line-160"></span><span>
</span><span id="line-161"></span><span class="annot"><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var">statExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgLet"><span class="hs-identifier hs-type">StgLet</span></a></span><span> </span><span class="annot"><span class="annottext">XLet 'Vanilla
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680954045"><span class="annot"><span class="annottext">GenStgBinding 'Vanilla
</span><a href="#local-6989586621680954045"><span class="hs-identifier hs-var">binds</span></a></span></span><span> </span><span id="local-6989586621680954044"><span class="annot"><span class="annottext">GenStgExpr 'Vanilla
</span><a href="#local-6989586621680954044"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-162"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; GenStgBinding 'Vanilla -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statBinding"><span class="hs-identifier hs-var">statBinding</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-comment">{-not top-level-}</span><span> </span><span class="annot"><span class="annottext">GenStgBinding 'Vanilla
</span><a href="#local-6989586621680954045"><span class="hs-identifier hs-var">binds</span></a></span><span>    </span><span class="annot"><span class="annottext">StatEnv -&gt; StatEnv -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#combineSE"><span class="hs-operator hs-var">`combineSE`</span></a></span><span>
</span><span id="line-163"></span><span>    </span><span class="annot"><span class="annottext">GenStgExpr 'Vanilla -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var">statExpr</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgExpr 'Vanilla
</span><a href="#local-6989586621680954044"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-164"></span><span>
</span><span id="line-165"></span><span class="annot"><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var">statExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgCase"><span class="hs-identifier hs-type">StgCase</span></a></span><span> </span><span id="local-6989586621680954042"><span class="annot"><span class="annottext">GenStgExpr 'Vanilla
</span><a href="#local-6989586621680954042"><span class="hs-identifier hs-var">expr</span></a></span></span><span> </span><span class="annot"><span class="annottext">BinderP 'Vanilla
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">AltType
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680954041"><span class="annot"><span class="annottext">[GenStgAlt 'Vanilla]
</span><a href="#local-6989586621680954041"><span class="hs-identifier hs-var">alts</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-166"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenStgExpr 'Vanilla -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var">statExpr</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgExpr 'Vanilla
</span><a href="#local-6989586621680954042"><span class="hs-identifier hs-var">expr</span></a></span><span>       </span><span class="annot"><span class="annottext">StatEnv -&gt; StatEnv -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#combineSE"><span class="hs-operator hs-var">`combineSE`</span></a></span><span>
</span><span id="line-167"></span><span>    </span><span class="annot"><span class="annottext">[(AltCon, [Id], GenStgExpr 'Vanilla)] -&gt; StatEnv
forall {a} {b}. [(a, b, GenStgExpr 'Vanilla)] -&gt; StatEnv
</span><a href="#local-6989586621680954040"><span class="hs-identifier hs-var">stat_alts</span></a></span><span> </span><span class="annot"><span class="annottext">[(AltCon, [Id], GenStgExpr 'Vanilla)]
[GenStgAlt 'Vanilla]
</span><a href="#local-6989586621680954041"><span class="hs-identifier hs-var">alts</span></a></span><span>      </span><span class="annot"><span class="annottext">StatEnv -&gt; StatEnv -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#combineSE"><span class="hs-operator hs-var">`combineSE`</span></a></span><span>
</span><span id="line-168"></span><span>    </span><span class="annot"><span class="annottext">CounterType -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#countOne"><span class="hs-identifier hs-var">countOne</span></a></span><span> </span><span class="annot"><span class="annottext">CounterType
</span><a href="GHC.Stg.Stats.html#StgCases"><span class="hs-identifier hs-var">StgCases</span></a></span><span>
</span><span id="line-169"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-170"></span><span>    </span><span id="local-6989586621680954040"><span class="annot"><span class="annottext">stat_alts :: [(a, b, GenStgExpr 'Vanilla)] -&gt; StatEnv
</span><a href="#local-6989586621680954040"><span class="hs-identifier hs-var hs-var">stat_alts</span></a></span></span><span> </span><span id="local-6989586621680954039"><span class="annot"><span class="annottext">[(a, b, GenStgExpr 'Vanilla)]
</span><a href="#local-6989586621680954039"><span class="hs-identifier hs-var">alts</span></a></span></span><span>
</span><span id="line-171"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[StatEnv] -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#combineSEs"><span class="hs-identifier hs-var">combineSEs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(GenStgExpr 'Vanilla -&gt; StatEnv)
-&gt; [GenStgExpr 'Vanilla] -&gt; [StatEnv]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">GenStgExpr 'Vanilla -&gt; StatEnv
</span><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var">statExpr</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">GenStgExpr 'Vanilla
</span><a href="#local-6989586621680954038"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621680954038"><span class="annot"><span class="annottext">GenStgExpr 'Vanilla
</span><a href="#local-6989586621680954038"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(a, b, GenStgExpr 'Vanilla)]
</span><a href="#local-6989586621680954039"><span class="hs-identifier hs-var">alts</span></a></span><span> </span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-172"></span><span>
</span><span id="line-173"></span><span class="annot"><a href="GHC.Stg.Stats.html#statExpr"><span class="hs-identifier hs-var">statExpr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Stg.Syntax.html#StgLam"><span class="hs-identifier hs-type">StgLam</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; StatEnv
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;statExpr StgLam&quot;</span></span><span>
</span><span id="line-174"></span></pre></body></html>